package com.hq.fxh.HttpApi;




import android.util.Log;

import com.hq.fxh.Modle.SelectArticleShortRes;
import com.hq.fxh.Modle.SelectByCategoryIdRes;
import com.hq.fxh.Modle.ShareArticleRes;
import com.hq.fxh.Modle.ShareArticlesRes;
import com.hq.fxh.Modle.SumStatisticalRes;
import com.hq.fxh.No5_User.MyModle.Model.CommonRes;

import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;


/**
 * Created by guozaiss on 16/3/29.
 */
public class ArticleServiceImpl {
    public static ArticleService articleService;

    /**
     * 分享文章
     */
    public static void shareArticle(String uid,String key,int isfloat,Subscriber<ShareArticleRes> subscriber){
        articleService.shareArticle(uid,key,isfloat)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .unsubscribeOn(Schedulers.io())
                .subscribe(subscriber);
    }


    public static void pasterNewsUrl(String url,Subscriber<CommonRes> subscriber){
        articleService.pasterNewsUrl(url)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .unsubscribeOn(Schedulers.io())
                .subscribe(subscriber);
    }

    /**
     * 【获取用户分享的文章列表】
     * @param
     * @return
     */
    public static void getShareArticles(String uid, int page, int pageSize, Subscriber<ShareArticlesRes> subscriber){
        articleService.getShareArticles(uid,page,pageSize)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .unsubscribeOn(Schedulers.io())
                .subscribe(subscriber);
    }


    /**
     * 【获取用户分享文章总统计数】(总曝光、总点击、总转发)
     */
    public static void getShareArticleStatisticalRestul(String uid, Subscriber<SumStatisticalRes> subscriber){
        articleService.getShareArticleStatisticalRestul(uid)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .unsubscribeOn(Schedulers.io())
                .subscribe(subscriber);
    }

}